<template>
    <view class="wrap">
        <MmvTitle title="热门租车" :type="0"></MmvTitle>
        <view class="list-wrap" v-if='list.length>0'>
            <template v-for="(item, index) in list">
                <MmvBuyBasic :bizType="1" :item="item" :key="index"></MmvBuyBasic>
            </template>
        </view>
		<view class='learMore' v-else >
			<no-data></no-data>
		</view>
    </view>
</template>

<script>
import MmvTitle from '@/components/layout/mmv-home-title.vue';
import MmvBuyBasic from '@/components/card/mmv-buy-basic.vue';
import * as HomeApi from '@/common/apis/home-api';

export default {
    name: 'mmv-buy-basic-list',
    components: {
        MmvTitle,
        MmvBuyBasic,
    },
    data() {
        return {
            list: [],
        }
    },
    computed: {
        deptId() {
            return this.$store.state.user.deptId;
        },
    },
	onLoad(e){
		uni.$on('emit', res=>{
			this.getList()
		})
	},
    async mounted() {
        await this.getList();
    },
    methods: {
        async getList() {
            try {
                const result = await HomeApi.scheme({
                    pageNo: 1, // 默认为1，当前页码
                    pageSize: 10, // 默认为10，每页行数
                    // deptId: this.deptId, // 门店id
					deptId:'',
					cityCode:uni.getStorageSync('cityCode'),
                    isPopularCarRental: 0, // 热门租车展示位(0是，1否)
                    bizType: 1, // 1.热门租车 2.以租代购 3.长租 4.金融分期 5.直购 6.试驾 7.选车
                    schemeType: -1, // bizType为5，6必传 1.直购； bizType为2必传 2分期购车；bizType为3 必传3租赁； bizType为4必传 4.金融分期 还有一种情况是选择租赁方式传递
                });
                this.list = result;
            } catch (error) {
                uni.showToast({ title: error, icon: 'error' });
            }
        },
    }
}
</script>

<style lang="scss" scoped>
.list-wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
	padding: 0upx 32upx;
}
</style>